/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package report.servico;

import camada.bancodedados.conexao.Conexao;
import camada.bancodedados.daoimplemente.servico.ServicoDAOImpl;
import eloma.classe.servico.Servico;
import java.io.InputStream;
import java.util.Hashtable;
import java.util.List;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author ICARO
 */
public class ReportServicoAvaliacao extends Thread {
    
    
    private InputStream relJasper;
    private Hashtable parametros;
    
    private List<Servico> listServico;
    private ServicoDAOImpl daoServico;
    Conexao c = new Conexao();   

    @Override
    public void run() {
        exibirRelatorio();
    }
    
    public ReportServicoAvaliacao(int idEmpresa, int mes, int ano) {
    
        String caminhoRelJasper = "reportServicoAvaliacao.jasper";     
        relJasper = this.getClass().getResourceAsStream(caminhoRelJasper);
        
        parametros = new Hashtable();
        parametros.put("IDEMPRESA", idEmpresa);
        parametros.put("MES", mes + 1);
        parametros.put("ANO", ano);
    }

    private void exibirRelatorio() {
        JasperPrint impressao = null;
        try {
            impressao = JasperFillManager.fillReport(relJasper, parametros, c.getCon());
            JasperViewer viewer = new JasperViewer(impressao, false);
            viewer.setVisible(true);
            viewer.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);
        }catch (JRException e) {
            JOptionPane.showMessageDialog(null, e.toString());
        }
    }

   

}
